/**
 * Created by ZQZQQD on 2017/3/2.
 */
$(function(){
    function addMyQuestionHander(data){
        var  successMessage=$("#successMessage");
        console.log(data);
            if(data.success){
                successMessage.css('color','green').html(data.message);
            }else{
                successMessage.css('color','red').html(data.message);
            }
    }
    function addMyQuestion(){
       // var phone=localStorage.getItem("user");
        var type='1';
        var theme=$('#myQuestionTitle').val();
        var content=$('#myQuestionDetail').val();
        var isTheme= util.isNull(theme);
        var isContent=util.isNull(content);
        var a= window.location.href;
        var aid=a.split("=");
        var phone = aid[1];
        if(isTheme==0&&isContent==0){
            var data={phone:phone,
                type:type,
                content:content,
                theme:theme,
                contact:phone
            };
            util.ajax('insertone',data,addMyQuestionHander);
        }
        else{
            $("#successMessage").html("输入的内容不能为空");
        }
    }
    $('#submitQuestion').click(function(){
        addMyQuestion();
    });
    $('#myQuestionTitle').keydown(function(){
        $("#successMessage").html("");
    });
    $('#myQuestionDetail').keydown(function(){
        $("#successMessage").css('color','red').html("");
    });
});